import os.path
from beaker.middleware import SessionMiddleware
import bottle
import app_defs
import controllers


@bottle.route('/static/:filename#.*#')
def static_route(filename):
  return bottle.static_file(filename, root=os.path.abspath('static'))


def main():
  bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.abspath(
      os.path.dirname(__file__)), 'views'))
  app = bottle.app()
  app.catchall = False
  app = SessionMiddleware(app, app_defs.SESSION_OPTS)
  bottle.run(app=app, server='gae')


if __name__ == '__main__':
  main()